﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style  TargetType="{x:Type TabControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel 
            Grid.Row="0"
            Panel.ZIndex="1" 
            Margin="0,0,4,-1" 
            IsItemsHost="True"
            Background="Transparent" />
                        <Border 
              Grid.Row="1"
              BorderThickness="0,1,0,0" 
							BorderBrush="{DynamicResource HighlightBrush}"
							Background="{DynamicResource BaseVerticalGradient}">
                            <ContentPresenter Margin="5,5,5,5"
                ContentSource="SelectedContent" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid>

                        <Border 
            Name="Border"
            Background="{DynamicResource LightBaseBrush}"
            BorderBrush="{DynamicResource LightBaseBrush}" 
            BorderThickness="0,1,0,0" 
            CornerRadius="4,4,0,0">
                            <ContentPresenter x:Name="ContentSite"
                VerticalAlignment="Center"
                HorizontalAlignment="Center"
                ContentSource="Header"
                Margin="12,2,12,2"/>
                        </Border>
                        <Border 
							Name="BottomBorder"
            BorderBrush="{DynamicResource HighlightBrush}" 
            BorderThickness="0,0,0,1" 
            CornerRadius="4,4,0,0"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Border" 
                    Property="Background" Value="{DynamicResource LightBaseBrush}" />
                            <Setter TargetName="Border" 
                    Property="BorderBrush" Value="{DynamicResource HighlightBrush}" />
                            <Setter TargetName="BottomBorder" 
                    Property="BorderBrush" Value="{DynamicResource LightBaseBrush}" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="False">
                            <Setter TargetName="Border" 
                    Property="Background" Value="{DynamicResource DarkBaseBrush}" />
                            <Setter TargetName="Border" 
                    Property="BorderBrush" Value="{DynamicResource BaseBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource DarkBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Button}" >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Rectangle RadiusX="4" RadiusY="4" Fill="{DynamicResource DarkBaseBrush}"/>
                        <Rectangle x:Name="Edge" RadiusX="4" RadiusY="4" Fill="{DynamicResource LightBaseBrush}" Margin="1,1,1,1"/>
                        <Rectangle x:Name="Face"  RadiusX="4" RadiusY="4" Fill="{DynamicResource BaseVerticalGradient}" Margin="2,2,2,2"/>
                        <ContentPresenter x:Name="Content" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="4,4,4,4"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Edge" Property="Fill" Value="{DynamicResource DarkDarkBrush}"/>
                            <Setter TargetName="Face" Property="Margin" Value="2,2,1,1"/>
                            <Setter TargetName="Face" Property="Fill" Value="{DynamicResource BaseVerticalGradientInverted}"/>
                            <Setter TargetName="Content" Property="Margin" Value="5,5,3,3"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Face" Property="Fill" Value="{DynamicResource BaseBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource DarkBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ToggleButton}" >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid>
                        <Rectangle RadiusX="4" RadiusY="4" Fill="{DynamicResource DarkBaseBrush}"/>
                        <Rectangle x:Name="Edge" RadiusX="4" RadiusY="4" Fill="{DynamicResource LightBaseBrush}" Margin="1,1,1,1"/>
                        <Rectangle x:Name="Face"  RadiusX="4" RadiusY="4" Fill="{DynamicResource BaseVerticalGradient}" Margin="2,2,2,2"/>
                        <ContentPresenter x:Name="Content" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="4,4,4,4"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Edge" Property="Fill" Value="{DynamicResource DarkDarkBrush}"/>
                            <Setter TargetName="Face" Property="Margin" Value="2,2,1,1"/>
                            <Setter TargetName="Face" Property="Fill" Value="{DynamicResource BaseVerticalGradient}"/>
                            <Setter TargetName="Content" Property="Margin" Value="5,5,3,3"/>
                        </Trigger>

                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="Edge" Property="Fill" Value="{DynamicResource DarkDarkBrush}"/>
                            <Setter TargetName="Face" Property="Margin" Value="2,2,1,1"/>
                            <Setter TargetName="Face" Property="Fill" Value="{DynamicResource BaseVerticalGradient}"/>
                            <Setter TargetName="Content" Property="Margin" Value="5,5,3,3"/>
                        </Trigger>

                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Face" Property="Fill" Value="{DynamicResource BaseBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource DarkBrush}"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <BorderGapMaskConverter x:Key="BorderGapMaskConverter"/>
    <Style TargetType="{x:Type GroupBox}">
        <Setter Property="BorderBrush" Value="{DynamicResource DarkBrush}"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupBox}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="6"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="6"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="6"/>
                        </Grid.RowDefinitions>
                        <Border Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3"/>
                        <Border x:Name="Header" Padding="3,0,3,0" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" TextElement.Foreground="{TemplateBinding Foreground}" ContentSource="Header" RecognizesAccessKey="True"/>
                        </Border>
                        <ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2"/>
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3">
                            <Border.OpacityMask>
                                <MultiBinding Converter="{StaticResource BorderGapMaskConverter}" ConverterParameter="7">
                                    <Binding Path="ActualWidth" ElementName="Header"/>
                                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
                                </MultiBinding>
                            </Border.OpacityMask>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="HorizontalGridSplitter" TargetType="{x:Type GridSplitter}">
        <Setter Property="Background" Value="{DynamicResource BaseVerticalGradient}" />
    </Style>

    <Style x:Key="VerticalGridSplitter" TargetType="{x:Type GridSplitter}">
        <Setter Property="Background" Value="{DynamicResource BaseHorizontalGradient}" />
    </Style>


    <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border 
          CornerRadius="3" 
          Background="{DynamicResource BaseVerticalGradientInverted}"
          BorderBrush="{DynamicResource BaseBrush}"
          BorderThickness="1" Margin="0,0,0,0"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.00001*"/>
            </Grid.RowDefinitions>
            <Border
      Grid.RowSpan="1"
      CornerRadius="3"
      Background="{DynamicResource DarkVerticalGradientInverted}" />

            <Track 
      Name="PART_Track"
      Grid.Row="0"
      IsDirectionReversed="true" Margin="0,0,0,0">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb 
          Style="{StaticResource ScrollBarThumb}" 
          Margin="1,1,1,1"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>
            </Track>

        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.00001*"/>
            </Grid.ColumnDefinitions>
            <Border
      CornerRadius="3" 
      Background="{DynamicResource DarkVerticalGradientInverted}" />
            <Track 
      Name="PART_Track"
      Grid.Column="1"
      IsDirectionReversed="False" Margin="0,0,0,0">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb 
          Style="{StaticResource ScrollBarThumb}" 
          Margin="1,1,1,1" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
        </Grid>
    </ControlTemplate>

    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="8" />
                <Setter Property="Margin" Value="0,5,0,0" />
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="8"/>
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Margin" Value="5,0,0,0" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
            </Trigger>
        </Style.Triggers>
    </Style>


    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="20" />
            </Grid.ColumnDefinitions>
            <Border
      x:Name="Border" 
      Grid.ColumnSpan="2"
      CornerRadius="4"
      Background="{DynamicResource BaseVerticalGradient}"
      BorderBrush="{DynamicResource DarkBrush}"
      BorderThickness="1" />
            <Border 
      Grid.Column="0"
      CornerRadius="2,0,0,2" 
      Margin="1" 
      Background="{DynamicResource BrightVerticalGradient}" 
      BorderBrush="{DynamicResource DarkBrush}"
      BorderThickness="0,0,1,0" />
            <Path 
      x:Name="Arrow"
      Grid.Column="1"     
      Fill="{TemplateBinding Foreground}"
      HorizontalAlignment="Center"
      VerticalAlignment="Center"
      Data="M 0 0 L 4 4 L 8 0 Z"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="Border" Property="Background" Value="{DynamicResource BaseBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource DarkBrush}"/>
                <Setter TargetName="Arrow" Property="Fill" Value="{DynamicResource DarkBrush}" />
            </Trigger>
            <Trigger Property="Control.IsMouseOver"
               Value="True">
                <Setter Property="Control.Opacity" Value="1"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
        <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}"  />
    </ControlTemplate>

    <Style x:Key="{x:Type ComboBox}" TargetType="ComboBox">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid x:Name="Container" >
                        <ToggleButton 
            Name="ToggleButton" 
            Template="{StaticResource ComboBoxToggleButton}" 
            Grid.Column="2" 
            Focusable="false"
            IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
            ClickMode="Press">
                        </ToggleButton>
                        <ContentPresenter
            Name="ContentSite"
            IsHitTestVisible="False" 
            Content="{TemplateBinding SelectionBoxItem}"
            ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
            ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
            Margin="3,3,23,3"
            VerticalAlignment="Center"
            HorizontalAlignment="Left" />
                        <TextBox x:Name="PART_EditableTextBox"
            Style="{x:Null}" 
            Template="{StaticResource ComboBoxTextBox}" 
            HorizontalAlignment="Left" 
            VerticalAlignment="Center" 
            Margin="3,3,23,3"
            Focusable="True" 
            Background="Transparent"
            Visibility="Hidden"
            IsReadOnly="{TemplateBinding IsReadOnly}"/>
                        <Popup 
            Name="Popup"
            Placement="Bottom"
            IsOpen="{TemplateBinding IsDropDownOpen}"
            AllowsTransparency="True" 
            Focusable="False"
            PopupAnimation="Fade">
                            <Grid 
              Name="DropDown"
              SnapsToDevicePixels="True"                
              MinWidth="{TemplateBinding ActualWidth}"
              MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border 
                x:Name="DropDownBorder"
                Background="{DynamicResource BrightVerticalGradientInverted}"
                BorderThickness="1"
                BorderBrush="{DynamicResource DarkBrush}"/>
                                <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource DarkBrush}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
                            <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4"/>
                            <Setter TargetName="DropDownBorder" Property="Margin" Value="0,1,0,0"/>
                        </Trigger>
                        <Trigger Property="IsEditable"
               Value="true">
                            <Setter Property="IsTabStop" Value="false"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility"    Value="Visible"/>
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
        </Style.Triggers>
    </Style>


    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBoxBase}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="10"/>
        <Setter Property="MinHeight" Value="12"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Border 
          Name="Border"
          CornerRadius="4" 
          Padding="2"
          Background="{DynamicResource BrightVerticalGradientInverted}"
          BorderBrush="{DynamicResource DarkBrush}"
          BorderThickness="1" >
                        <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource BaseBrush}"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource DarkBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource DarkBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

	<Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Border Background="Transparent" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Height" Value="14"/>
		<Setter Property="Width" Value="8"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Rectangle
						RadiusX="3" RadiusY="3"
          Name="Ellipse" 
          Fill="{DynamicResource BaseVerticalGradient}"
          Stroke="{DynamicResource DarkBrush}"
          StrokeThickness="1" />
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource BaseVerticalGradient}"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource BaseBrush}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<ControlTemplate x:Key="HorizontalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto" MinHeight="{TemplateBinding Slider.MinHeight}"/>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>
			<TickBar 
      Name="TopTick"
      SnapsToDevicePixels="True" 
      Placement="Top"
      Fill="{DynamicResource DarkBrush}"
      Height="4"
      Visibility="Collapsed" />
			<Border 
      Name="TrackBackground"
      Margin="0"
      CornerRadius="2" 
      Height="4"
      Grid.Row="1"
      Background="{DynamicResource DarkVerticalGradientInverted}" 
      BorderBrush="{DynamicResource DarkBrush}"
      BorderThickness="1" />
			<Track Grid.Row="1" Name="PART_Track">
				<Track.DecreaseRepeatButton>
					<RepeatButton 
          Style="{StaticResource SliderButtonStyle}"
          Command="Slider.DecreaseLarge" />
				</Track.DecreaseRepeatButton>
				<Track.Thumb>
					<Thumb Style="{StaticResource SliderThumbStyle}" />
				</Track.Thumb>
				<Track.IncreaseRepeatButton>
					<RepeatButton 
          Style="{StaticResource SliderButtonStyle}"
          Command="Slider.IncreaseLarge" />
				</Track.IncreaseRepeatButton>
			</Track>
			<TickBar 
      Name="BottomTick"
      SnapsToDevicePixels="True" 
      Grid.Row="2"
      Fill="{TemplateBinding Foreground}"
      Placement="Bottom"
      Height="4"
      Visibility="Collapsed" />
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<ControlTemplate x:Key="VerticalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="Auto" MinWidth="{TemplateBinding Slider.MinWidth}"/>
				<ColumnDefinition Width="Auto"/>
			</Grid.ColumnDefinitions>
			<TickBar 
      Name="TopTick"
      SnapsToDevicePixels="True" 
      Placement="Left"
      Fill="{DynamicResource DarkBrush}"
      Width="4"
      Visibility="Collapsed" />
			<Border 
      Name="TrackBackground"
      Margin="0"
      CornerRadius="2" 
      Width="4"
      Grid.Column="1"
      Background="{DynamicResource HorizontalLightBrush}" 
      BorderBrush="{DynamicResource HorizontalNormalBorderBrush}"
      BorderThickness="1" />
			<Track Grid.Column="1" Name="PART_Track">
				<Track.DecreaseRepeatButton>
					<RepeatButton 
          Style="{StaticResource SliderButtonStyle}"
          Command="Slider.DecreaseLarge" />
				</Track.DecreaseRepeatButton>
				<Track.Thumb>
					<Thumb Style="{StaticResource SliderThumbStyle}" />
				</Track.Thumb>
				<Track.IncreaseRepeatButton>
					<RepeatButton 
          Style="{StaticResource SliderButtonStyle}"
          Command="Slider.IncreaseLarge" />
				</Track.IncreaseRepeatButton>
			</Track>
			<TickBar 
      Name="BottomTick"
      SnapsToDevicePixels="True" 
      Grid.Column="2"
      Fill="{TemplateBinding Foreground}"
      Placement="Right"
      Width="4"
      Visibility="Collapsed" />
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style TargetType="{x:Type Slider}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Style.Triggers>
			<Trigger Property="Orientation" Value="Horizontal">
				<Setter Property="MinWidth" Value="104" />
				<Setter Property="MinHeight" Value="21" />
				<Setter Property="Template" Value="{StaticResource HorizontalSlider}" />
			</Trigger>
			<Trigger Property="Orientation" Value="Vertical">
				<Setter Property="MinWidth" Value="21" />
				<Setter Property="MinHeight" Value="104" />
				<Setter Property="Template" Value="{StaticResource VerticalSlider}" />
			</Trigger>
		</Style.Triggers>
	</Style>
</ResourceDictionary>